home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
batch
/
sputls
/
hasmouse.doc
< prev
next >
Wrap
Text File
|
1991-01-06
|
2KB
|
70 lines
Has Mouse version 1.0 (C) SPETER SOFTWARE, January 1991.
This program will return an errorlevel to indicate the presence of
a (Microsoft compatible) mouse. The utility could be used in batch
files to execute alternate programs depending on the availability of
a mouse.
The program was written in Borland's Turbo Pascal 5.5
Usage:
------
1: HASMOUSE /h
Output a help screen.
2: HASMOUSE
Set the DOS errorlevel (environment variable) according to whether the
program is able to detect the presence of an installed mouse.
sets errorlevel = 0 if no mouse found
sets errorlevel = 1 if a mouse was found
Examples:
--------
The following are batch files that display a message informing the user if a
mouse was detected:
1: hasmouse
if errorlevel 1 goto mouseOK
if errorlevel 0 echo "no mouse was found"
goto end
:mouseOK
echo "a mouse was found"
:end
The commands above are useful if you only have one mouse specific section in
the batch file; otherwise, it is usually simpler to set an environment
variable (as in example 2).
NOTE that the DOS echo command will reset the errorlevel variable.
2: set UseMouse=
hasmouse
if errorlevel 1 set UseMouse=T
if %UseMouse%=T echo A mouse was found
if not %UseMouse%=T echo A mouse was NOT found
Set an environment variable if you want to know if a mouse is available in more
than one place in batch files. Remember to remove the environment variable
(see the first line of example 2), when you are finished using it, or at the
end of the batch file.
Correspondence:
---------------
Please address any comments to:
Stephen Peter
INTERNET:
steve@cad0.arch.unsw.oz.au
POST:
SPETER SOFTWARE
P.O. BOX 643
LANE COVE
NSW 2066
AUSTRALIA